home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Mathematics / Notebooks / URichMultivariateCalculus / 05 / Lab5.ma next >
Encoding:
Text File  |  1991-10-03  |  11.7 KB  |  240 lines

  1. (*^
  2.  
  3. ::[paletteColors = 128; 
  4.     fontset = title, "Times-Bold", 24, L2, center, bold, nohscroll;
  5.     fontset = subtitle, "Times-Bold", 18, L2, center, bold, nohscroll;
  6.     fontset = subsubtitle, "Times-Bold", 14, L2, center, bold, nohscroll;
  7.     fontset = section, "Times-Bold", 18, L2, bold, nohscroll, grayBox;
  8.     fontset = subsection, "Times-Bold", 14, L2, bold, nohscroll, blackBox;
  9.     fontset = subsubsection, "Times-Bold", 12, L2, bold, nohscroll, whiteBox;
  10.     fontset = text, "Times-Roman", 12, L2, nohscroll;
  11.     fontset = smalltext, "Times-Roman", 10, L2, nohscroll;
  12.     fontset = input, "Courier-Bold", 12, L2, bold, nowordwrap;
  13.     fontset = output, "Courier", 12, L2, nowordwrap;
  14.     fontset = message, "Courier", 12, L2, R21845, G21845, B21845, nowordwrap;
  15.     fontset = print, "Courier", 12, L2, nowordwrap;
  16.     fontset = info, "Courier", 12, L2, nowordwrap;
  17.     fontset = postscript, "Courier", 12, L2, nowordwrap;
  18.     fontset = name, "Times-Italic", 11, L2, italic, R21845, G21845, B21845, nowordwrap, nohscroll;
  19.     fontset = header, "Times", 10, L2;
  20.     fontset = footer, "Times", 12, L2, center;
  21.     fontset = help, "Times-Roman", 14, L2, nohscroll;
  22.     fontset = clipboard, "New York", 12, L2;
  23.     fontset = completions, "Courier", 16, L2, nowordwrap;
  24.     fontset = network, "Courier", 10, L2, nowordwrap;
  25.     fontset = graphlabel, "Courier", 12, L2, nowordwrap;
  26.     fontset = special1, "New York", 12, L2, nowordwrap;
  27.     fontset = special2, "New York", 12, L2, center, nowordwrap;
  28.     fontset = special3, "New York", 12, L2, right, nowordwrap;
  29.     fontset = special4, "New York", 12, L2, nowordwrap;
  30.     fontset = special5, "New York", 12, L2, nowordwrap;]
  31. :[font = title; inactive; startGroup; Cclosed; ]
  32. Lab 5: Applications of the Gradient
  33. :[font = text; inactive; startGroup; Cclosed; ]
  34. The gradient function was introduced in Lab 4.  There we saw that it is the analog of the ordinary derivative of a function of a single variable.  We used it to find the critical points of a function of two variables by solving the equation  grad[f,x,y]==0.
  35. :[font = text; inactive; endGroup; ]
  36. In this lab we study other applications of the gradient function.  Each of these applications is a direct generalization of an application of the ordinary derivative of a function of a single variable. 
  37. :[font = section; inactive; startGroup; Cclosed; ]
  38. The Gradient Function
  39. :[font = text; inactive; startGroup; Cclosed; ]
  40. We begin by defining the gradient function.  As in Lab 4, it is defined as the vector whose components are the partial derivatives of the given funtion f.  However, the applications in this lab will be easier to set up if we use the following alternative definition.
  41. :[font = input; ]
  42. Clear["@*"];
  43. grad[f_][x_,y_] = {D[f[x,y],x],D[f[x,y],y]};
  44. grad[f][x,y]
  45. :[font = text; inactive; endGroup; ]
  46. The only difference between this form and the form grad[f,x,y] that we used in Lab 4 is that this one makes the grad a function of f whose value is another function of x and y.  For all practical purposes, grad[f,x,y] and grad[f][x,y] work the same way; only the notation looks different.
  47. :[font = subsection; inactive; startGroup; Cclosed; ]
  48. Example
  49. :[font = text; inactive; startGroup; Cclosed; ]
  50. The following example is taken from Example 1 on page 666 of Stein:
  51. :[font = input; endGroup; ]
  52. Clear[f];
  53. f[x_,y_] := x^2 y^3; 
  54. f[x,y]
  55. :[font = text; inactive; startGroup; Cclosed; ]
  56. the gradient of this function is a vector with two-component of functions:
  57. :[font = input; endGroup; ]
  58. grad[f][x,y]
  59. :[font = text; inactive; startGroup; Cclosed; ]
  60. The value of the gradient at the point (1,2) is a two-component vector constant:
  61. :[font = input; ]
  62. grad[f][1,2]
  63. :[font = text; inactive; endGroup; endGroup; ]
  64. Recall that Mathematica writes vectors with curly braces { }.
  65. :[font = subsection; inactive; startGroup; Cclosed; noPageBreak; ]
  66. Exercises
  67. :[font = text; inactive; ]
  68. These exercises are from Stein:
  69. :[font = text; inactive; ]
  70. 1. {3p.670} Evaluate the gradient of x^2 y at (2,5).
  71. :[font = text; inactive; endGroup; endGroup; ]
  72. 2. {4p.670} Evaluate the gradient of 1/Sqrt[x^2+y^2] at (1,2).
  73. :[font = section; inactive; startGroup; Cclosed; pageBreak; ]
  74. The Differential
  75. :[font = text; inactive; startGroup; Cclosed; ]
  76. The differential df of a function f of two variables is itself a function of four variables.  It is defined to be the dot product of the two-component vector grad[f][x,y] and the two-component vector {dx,dy}.  Here dx and dy are independent variables.  This unusual notation is used traditionally because, in practice, dx and dy usually represent very small increments in x and y, respectively.
  77. :[font = input; ]
  78. Clear[f];
  79. d[f_][x_,y_,dx_,dy_] = grad[f][x,y].{dx,dy}; 
  80. d[f][x,y,dx,dy]
  81. :[font = text; inactive; ]
  82. When printed as output, partial derivatives are written with the vector superscript notation.  Thus:        (0,1)                              
  83.                                 f         [x,y] means the partial of f with respect to y.
  84. :[font = text; inactive; ]
  85. Notice that we again define the object to be a function of the function f whose value is another function, this time of the four variables x, y, dx, and dy.
  86. :[font = text; inactive; endGroup; ]
  87. Functions like grad and d which transform one function into another are called operators.
  88. :[font = subsection; inactive; startGroup; Cclosed; ]
  89. Example
  90. :[font = text; inactive; startGroup; Cclosed; ]
  91. We continue with the same example as above:
  92. :[font = input; ]
  93. Clear[f];
  94. f[x_,y_] := x^2 y^3;
  95. f[x,y]
  96. :[font = input; ]
  97. d[f][x,y,dx,dy]
  98. :[font = text; inactive; endGroup; ]
  99. Clearly, this is a function of the four variables x, y, dx, and dy.
  100. :[font = text; inactive; startGroup; Cclosed; ]
  101. Here's the value of the function at the point (x,y) = (1,2):
  102. :[font = input; ]
  103. d[f][1,2,dx,dy]
  104. :[font = text; inactive; endGroup; ]
  105. This is a function of the remaining two variables dx and dy.
  106. :[font = text; inactive; startGroup; Cclosed; ]
  107. Now, to appreciate the significance of the differential, we compare the two values of the function f at the nearby points (1,2) and (1.003,2.005):
  108. :[font = input; ]
  109. z0 = f[1,2]
  110. :[font = input; endGroup; ]
  111. z1 = f[1.003,2.005]
  112. :[font = text; inactive; startGroup; Cclosed; ]
  113. The difference betgween these two values is:
  114. :[font = input; endGroup; ]
  115. z1 - z0
  116. :[font = text; inactive; startGroup; Cclosed; ]
  117. This difference will be very nearly the same as the differential at the point (1,2) with increments dx=0.003 and dy=0.005:
  118. :[font = input; ]
  119. d[f][1,2,0.003,0.005]
  120. :[font = text; inactive; endGroup; endGroup; ]
  121. In practice (in the absence of Mathematica), the differential is usually easy to compute.  So it is used to estimate the nearby value of f:  f(x+dx,y+dy) = f(x,y) + df.
  122. :[font = subsection; inactive; startGroup; Cclosed; noPageBreak; ]
  123. Exercises
  124. :[font = text; inactive; ]
  125. These exercises are from Stein.  Compute and compare the change in f with df for the given f, x, y, dx, and dy:
  126. :[font = text; inactive; ]
  127. 1. {3p.654} f [x_,y_] := x/y, x=2, y=1, dx=0.1, dy=-0.2.
  128. :[font = text; inactive; endGroup; endGroup; ]
  129. 2. {5p.654} f [x_,y_] := x^2 + x*y^2 + y^3, x=1, y=1, dx=0.1, dy=-0.2.
  130. :[font = section; inactive; startGroup; Cclosed; noPageBreak; ]
  131. The Tangent Plane
  132. :[font = text; inactive; ]
  133. The tangent plane for a function of two variables is analogous to the tangent line for a function of one variable.  The tangent line to a function y = f (x) at the point where x=x0 is  y = f (x0) + f '(x0)(x-x0).  The tangent plane to a function z = f (x,y) at the point (x,y)=(x0,y0) is z = f (x0,y0) + grad[f](x0,y0).{x-x0,y-y0}, where the dot is the dot product.  But, as we just saw, that dot product is the differential d[f][x0,y0,x-x0,y-y0]:
  134. :[font = input; ]
  135. Clear[f];
  136. t[f_][x0_,y0_,x_,y_] = f[x0,y0] + d[f][x0,y0,x-x0,y-y0]; 
  137. t[f][x0,y0,x,y]
  138. :[font = text; inactive; ]
  139. This definition shows that the vertical displacement along the tangent plane is simply the differential:
  140.  
  141.                          t[f_][x0_,y0_,x_,y_] - f[x0,y0] = d[f][x0,y0,x-x0,y-y0]
  142.  
  143. :[font = text; inactive; ]
  144. Like the differential, the tangent plane function t[f] is a function of four variables: x0, y0, x, and y.
  145. :[font = subsection; inactive; startGroup; Cclosed; ]
  146. Example
  147. :[font = input; startGroup; Cclosed; ]
  148. Clear[f];
  149. f[x_,y_] := x^2 y^3;
  150. f[x,y]
  151. :[font = input; startGroup; Cclosed; ]
  152. t[f][x0,y0,x,y]
  153. :[font = input; ]
  154. t[f][1,2,x,y]
  155. :[font = input; endGroup; ]
  156. Simplify[%]
  157. :[font = text; inactive; startGroup; Cclosed; ]
  158. After simplifying, we can see that this is the equation of a plane.  The vector of coefficients (16,12) is the normal vector to the plane.
  159. :[font = input; ]
  160. grad[f][1,2]
  161. :[font = text; inactive; endGroup; ]
  162. This verifies that the gradient is normal to the surface.
  163. :[font = text; inactive; startGroup; Cclosed; ]
  164. The tangent plane and the function have the same value at (1,2):
  165. :[font = input; ]
  166. t[f][1,2,1,2]
  167. :[font = input; endGroup; endGroup; endGroup; ]
  168. f[1,2]
  169. :[font = subsection; inactive; startGroup; Cclosed; pageBreak; ]
  170. Exercises
  171. :[font = text; inactive; ]
  172. Find (and simplify) the equation of the tangent plane to the graph of the given function at the given point:
  173. :[font = text; inactive; ]
  174. 1. f [x_,y_] := x^2 y at (2,5).
  175. :[font = text; inactive; ]
  176. 2. f [x_,y_] :=  1/Sqrt[x^2+y^2] at (1,2).
  177. :[font = text; inactive; endGroup; endGroup; ]
  178. 3. f [x_,y_] :=  x^2 + x*y^2 + y^3 at (1,1).
  179. :[font = section; inactive; startGroup; Cclosed; pageBreak; ]
  180. The Chain Rule
  181. :[font = text; inactive; startGroup; Cclosed; ]
  182. The Chain Rule says that the derivative of a composite of functions is the product of the derivatives of their component functions.  For functions of a single variable, this is:
  183. :[font = input; ]
  184. Clear[f,g,h,x,y];
  185. D[f[g[x]],x]
  186. :[font = text; inactive; startGroup; Cclosed; ]
  187. Now suppose f is a function of two variables, each of which is itself a function of another variable t.  Then, as above, we replace f ' with grad[f] and use the dot product:
  188.  
  189.                         D[f [g[t],h[t]] = grad[f][g[t],h[t]] . {g' [t], h'[t]}
  190. :[font = input; endGroup; ]
  191. D[f[g[t],h[t]],t]
  192. :[font = text; inactive; startGroup; Cclosed; ]
  193. This can also be done using the total derivative.  Written Dt, it assumes that every variable is a function of something, thus leaving another Dt form in each term:
  194. :[font = input; ]
  195. Dt[f[x,y]]
  196. :[font = text; inactive; endGroup; endGroup; ]
  197. This is essentially the same as the differential equation:
  198.  
  199.                                  df [x,y] = f  [x,y] dx  + f  [x,y] dy
  200.                                                    x                    y
  201. :[font = subsection; inactive; startGroup; Cclosed; noPageBreak; ]
  202. Example
  203. :[font = text; inactive; startGroup; Cclosed; ]
  204. Here's the same example that we used above:
  205. :[font = input; endGroup; ]
  206. Clear[f,x,y];
  207. f[x_,y_] := x^2 y^3;
  208. f[x,y]
  209. :[font = text; inactive; startGroup; Cclosed; ]
  210. If we do not first specify how x and y depend upon t, then the total derivative has the usual form of the differential: 
  211. :[font = input; ]
  212. Dt[f[x,y]]
  213. :[font = input; ]
  214. grad[f][x,y]
  215. :[font = input; endGroup; ]
  216. d[f][x,y,dx,dy]
  217. :[font = text; inactive; startGroup; Cclosed; ]
  218. Now select the following functions for x and y;
  219. :[font = input; endGroup; ]
  220. x = 3t^2;
  221. y = t/3;
  222. :[font = text; inactive; startGroup; Cclosed; ]
  223. These make f  a composite function of t:
  224. :[font = input; endGroup; ]
  225. f[x,y]
  226. :[font = text; inactive; startGroup; Cclosed; ]
  227. It's derivative can be obtained by either method:
  228. :[font = input; ]
  229. D[f[x,y],t]
  230. :[font = input; endGroup; endGroup; ]
  231. Dt[f[x,y]]
  232. :[font = subsection; inactive; startGroup; Cclosed; pageBreak; ]
  233. Exercises
  234. :[font = text; inactive; ]
  235. First compute the total derivative Dt [f [x,y]] of the given function and compare it with the differential d[f][x,y,dx,dy].  Then define x and y as indicated (in terms of t) , re-exammine f [x,y], and compute its derivative with both D[f [x,y],t] and Dt [f [x,y]].  Simplify expressions wherever necessary.
  236. :[font = text; inactive; ]
  237. 1. f [x_,y_] := x/y;  x = t^3, y = 1+t^4.
  238. :[font = text; inactive; endGroup; endGroup; endGroup; ]
  239. 2. f [x_,y_] := x^2 + x*y^2 + y^3;  x = Cos[t], y = Sin[t].
  240. ^*)